// --------------------------------------------------------------------------------------------
// Version: MPL 1.1/GPL 2.0/LGPL 2.1
// 
// The contents of this file are subject to the Mozilla Public License Version
// 1.1 (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
// http://www.mozilla.org/MPL/
// 
// Software distributed under the License is distributed on an "AS IS" basis,
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
// for the specific language governing rights and limitations under the
// License.
// 
// <remarks>
// Generated by IDLImporter from file nsIAddonInterposition.idl
// 
// You should use these interfaces when you access the COM objects defined in the mentioned
// IDL/IDH file.
// </remarks>
// --------------------------------------------------------------------------------------------
namespace Gecko
{
	using System;
	using System.Runtime.InteropServices;
	using System.Runtime.InteropServices.ComTypes;
	using System.Runtime.CompilerServices;
	
	
	/// <summary>
    /// This interface allows Firefox to expose different implementations of its own
    /// classes to add-ons. Once an interposition is created, it must be assigned to
    /// an add-on using Cu.setAddonInterposition (JS) or xpc::SetAddonInterposition
    /// (C++). In both cases, the arguments should be the add-on ID and the
    /// interposition object (which must be an nsIAddonInterposition). This must
    /// happen before any compartments are created for the given add-on.
    ///
    /// Every time the add-on accesses a property on any object outside its own set
    /// of compartments, XPConnect will call the interposition's
    /// interpose method. If the interposition wants to replace the given
    /// property, it should return a replacement property descriptor for it. If not,
    /// it should return null.
    /// </summary>
	[ComImport()]
	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
	[Guid("d05cc5fd-ad88-41a6-854c-36fd94d69ddb")]
	public interface nsIAddonInterposition
	{
		
		/// <summary>
        /// Returns a replacement property descriptor for a browser object.
        ///
        /// @param addonId The ID of the add-on accessing the property.
        /// @param target The browser object being accessed.
        /// @param iface The IID of the interface the property is associated with. This
        /// parameter is only available for XPCWrappedNative targets. As
        /// such, it's only useful as an optimization to avoid
        /// instanceof checks on the target.
        /// @param prop The name of the property being accessed.
        /// @return A property descriptor or null.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		Gecko.JsVal InterposeProperty(ref Gecko.JsVal addonId, ref Gecko.JsVal target, System.Guid iface, ref Gecko.JsVal prop);
		
		/// <summary>
        /// We're intercepting calls from add-ons scopes into non-addon scopes.
        ///
        /// @param addonId The ID of the add-on accessing the property.
        /// @param originalFunc The function object being intercepted.
        /// @param originalThis The |this| value for the intercepted call.
        /// @param args The arguments of the original call in an array.
        /// @return The result of the call. NOTE: after the call interception,
        /// the original function will not be called automatically, so the
        /// implementer has to do that.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		Gecko.JsVal InterposeCall(ref Gecko.JsVal addonId, ref Gecko.JsVal originalFunc, ref Gecko.JsVal originalThis, ref Gecko.JsVal args);
		
		/// <summary>
        /// For the first time when the interposition is registered the engine
        /// calls getWhitelist and expects an array of strings. The strings are
        /// the name of properties the interposition wants interposeProperty
        /// to be called. It can be an empty array.
        /// Note: for CPOWs interposeProperty is always called regardless if
        /// the name of the property is on the whitelist or not.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		Gecko.JsVal GetWhitelist();
	}
}
